/*
 * Brackets.cxx
 *
 *  Created on: 6:26:48 PM Oct 29, 2012
 *      Author: Pallab
 * "I have not failed, I have just found 10000 ways that won't work.
 */

#include <iostream>
#include <algorithm>
#include <vector>
#include <sstream>
#include <fstream>
#include <string>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <numeric>
#include <stack>
#include <functional>
#include <bitset>
#include <iomanip>

#include <ctime>
#include <cassert>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <climits>
#include <cstring>
#include <cstdlib>

using namespace std;

#define foR(i1,st,ed) for(int i1 = st , j1 = ed ; i1 < j1 ; ++i1 )
#define fo(i1,ed) foR( i1 , 0 , ed )
#define foE(i1,st,ed) foR( i1, st, ed+1 )
#define foit(i, x) for (typeof((x).begin()) i = (x).begin(); i != (x).end(); i++)
#define bip system("pause")
#define Int long long
#define pb push_back
#define SZ(X) (int)(X).size()
#define LN(X) (int)(X).length()
#define mk make_pair
#define SET( ARRAY , VALUE ) memset( ARRAY , VALUE , sizeof(ARRAY) )
#define line puts("")

inline void wait(double seconds) {
	double endtime = clock() + (seconds * CLOCKS_PER_SEC);
	while (clock() < endtime) {
		;
	}
}
#define T int
inline T fastIn() {
	register char c = 0;
	register T a = 0;
	bool neg = false;
	while (c < 33)
		c = getchar();
	while (c > 33) {
		if (c == '-') {
			neg = true;
		} else {
			a = (a * 10) + (c - '0');
		}
		c = getchar();
	}
	return neg ? -a : a;
}
inline void read();
inline void proc(int);
const int MX = 30010;
int lstr;
char str[MX];
struct NODE {
	int open_count;
	int close_count;
	NODE() {
		open_count = close_count = 0;
	}
	NODE(int open_count, int close_count) :
			open_count(open_count), close_count(close_count) {
		;
	}

};
inline NODE add(NODE a, NODE b, int mn) {
	return NODE(a.open_count + b.open_count - mn,
			a.close_count + b.close_count - mn);
}
inline NODE create(char ch) {
	return NODE(ch == '(' ? 1 : 0, ch == ')' ? 1 : 0);
}
namespace segtree {
NODE t[4 * MX];
void build(int v, int l, int r) {
	if (l == r) {
		t[v] = create(str[l]);
	} else {
		int m = (l + r) >> 1;
		int v1 = v << 1, v2 = (v << 1) + 1;
		build(v1, l, m), build(v2, m + 1, r);
		int mn = min(t[v1].open_count, t[v2].close_count);
		t[v] = add(t[v1], t[v2], mn);
		/*	cout<<v<<' '<<l<<' '<<r<<" \n";t[v1].print(),t[v2].print();t[v].print();
		 puts("___");*/
	}
}
void update(int v, int l, int r, int pos) {
	if (l == r) {
		t[v] = create(str[pos]);
	} else {
		int m = (l + r) >> 1;
		int v1 = v << 1, v2 = (v << 1) + 1;
		if (pos <= m) {
			update(v1, l, m, pos);
		} else {
			update(v2, m + 1, r, pos);
		}
		int mn = min(t[v1].open_count, t[v2].close_count);
		t[v] = add(t[v1], t[v2], mn);
	}
}
}
;
int main() {
	int kase = 1;
#if defined( xerxes_pc )
	if (!freopen("in1", "r", stdin))
		puts("error opening file in "), assert(0);
	kase = 1;
#endif
	while (scanf("%d\n", &lstr) == 1) {
		read();
		proc(kase);
		++kase;
	}
	return 0;
}
inline void read() {
	gets(str);
}

inline void proc(int kase) {
	cout << "Test " << kase << ":\n";
	segtree::build(1, 0, lstr - 1);
	int q = fastIn();
	while (q--) {
		int indx = fastIn();
		if (indx == 0) {
			puts(
					segtree::t[1].close_count || segtree::t[1].open_count ?
							"NO" : "YES");
		} else {
			--indx;
			str[indx] = str[indx] == '(' ? ')' : '(';
			segtree::update(1, 0, lstr - 1, indx);
		}
	}
}
